<template>
  <div class="home">
    <router-link to="/learn">HOME-LEARN</router-link>
    <p>你好，{{login.USER_NAME}}</p>
    <button @click="logOut">退出登录</button>
  </div>
</template>

<script>
// @ is an alias to /src
import { mapState } from 'vuex'
// console.log(process.env.VUE_APP_BASE_URL)
export default {
  name: "home",
  data() {
    return {
    }
  },
  computed: {
    ...mapState(['login'])
  },
  created() { 
  },
  methods: {
    logOut() {
      this.$store.commit('LOGIN_OUT')
      this.$store.commit('REMOVE_USERNAME')
      this.$router.push('/login')
    }
  }
};
</script>
